<template>
	<view class="step-body">
		<view class="purchase-module">
			<view class="purchase-title">
				安全因素
			</view>
			<view class="purchase-content">
				<view class="content-box">
					<view class="cbox-1">
						危险因素
					</view>
					<view class="cbox-2">
						{{checkList}}
					</view>
				</view>
				<view class="content-box">
					<view class="cbox-1">
						操作和维护责<br> 任人
					</view>
					<view class="cbox-2">
						{{equipmentManagerUser}}
					</view>
				</view>
				<view class="content-box">
					<view class="cbox-1">
						设备管理责任<br>人
					</view>
					<view class="cbox-2">
						{{operationMaintenanceUser}}
					</view>
				</view>
				<view class="content-box">
					<view class="cbox-1">
						安装地址
					</view>
					<view class="cbox-2">
						{{installationPlace}}
					</view>
				</view>
				<view class="content-box">
					<view class="cbox-1">
						设备使用面积 (m²)
					</view>
					<view class="cbox-2">
						{{equipmentUseArea}}
					</view>
				</view>

			</view>
		</view>
		<view class="purchase-module">
			<view class="purchase-title">
				调研情况
			</view>
			<view class="purchase-content">
				<view class="rbox-1" v-for="item in InvestList " :key='item.id'>
					<view class="rbox-title">
						{{item.supplierName}}
					</view>
					<view class="rbox-item">
						<text>初步报价(万元)：</text>
						<text>{{item.firstQuote?item.firstQuote.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','):'--'}}</text>
					</view>
					<view class="rbox-item">
						<text>联系人：</text>
						<text>{{item.contacts}}</text>
					</view>
					<view class="rbox-item">
						<text>联系方式：</text>
						<text>{{item.phone}}</text>
					</view>
				</view>
				<view class="rbox-3" style="line-height: 90rpx;text-align: center;" v-if="InvestList.length==0">
					暂无数据！
				</view>
			</view>
		</view>
		<view class="purchase-module">
			<view class="purchase-title">
				采购标的
			</view>
			<view class="purchase-content">
				<view class="content-qbox">
					<view class="qbox-1" style="line-height: 46rpx;">
						采购标的需求实现的功能或目标
					</view>
					<view class="qbox-3">
						<rich-text :nodes="purGoal"></rich-text>
					</view>
				</view>
				<view class="content-qbox">
					<view class="qbox-1" style="line-height: 46rpx;">
						采购标的需执行的国家相关标准、行业标准、地方标准或其他标准、规范
					</view>
					<view class="qbox-3">
						<rich-text :nodes="purStandard"></rich-text>
					</view>
				</view>
				<view class="content-qbox">
					<view class="qbox-1" style="line-height: 46rpx;">
						采购标的的验收标准
					</view>
					<view class="qbox-3">
						<rich-text :nodes="purAcceptStandard" ></rich-text>
					</view>
				</view>
				<view class="content-qbox">
					<view class="qbox-1" style="line-height: 46rpx;">
						重要指标
					</view>
					<view class="qbox-3">
						<rich-text :nodes="importTarget" ></rich-text>
					</view>
				</view>
				<view class="content-qbox">
					<view class="qbox-1" style="line-height: 46rpx;">
						一般指标
					</view>
					<view class="qbox-3">
						<rich-text :nodes="generalTarget" ></rich-text>
					</view>
				</view>
			</view>
			<view class="purchase-title">
				为落实政府采购政策需满足要求
			</view>
			<view class="purchase-content">
				<view class="content-qbox">
					<view class="qbox-3" v-if="governmentProcurementDemands.indexOf('1') !== -1">
						1、鼓励节能政策：在技术、服务同等条件下，优先采购属于国家公布的节能清单中产品
					</view>
					<view class="qbox-3" v-if="governmentProcurementDemands.indexOf('2') !== -1">
						2、鼓励环保政策：在性能、技术、服务等指标同等条件下，优先采购国家公布的环保
					</view>
					<view class="qbox-3" v-if="governmentProcurementDemands.indexOf('3') !== -1">
						3、扶持中小企业政策：评审时小型和微型企业产品享受6%的价格折扣
					</view>
					<view class="qbox-3" v-if="governmentProcurementDemands.indexOf('4') !== -1">
						4、投标产品不得为进口产品。（如采购进口产品，须提交政府采购进口产品审批表
					</view>
					<view class="qbox-3" v-if="governmentProcurementDemands.indexOf('5') !== -1">
						5、专门面向中小企业
					</view>
				</view>
				<view class="content-qbox" v-if="reasonStatus">
					<view class="qbox-1" style="line-height: 46rpx;">
						说明原因
					</view>
					<view class="qbox-3">
						<rich-text :nodes="governmentProcurementDemandExplain" ></rich-text>
					</view>
				</view>
				<view class="content-qbox" v-if="reasonStatus">
					<view class="qbox-1" style="line-height: 46rpx;">
						附件
					</view>
					<!-- <div class v-for="item in fileList" :key="item.id" style="margin-bottom: 8px; padding: 6px 10px">
					                    <a @click="downLoadFile(item.id)" style="margin-right: 20px">{{ item.fileSourceName }}</a>
					                    <a-icon @click="deleteFile(item.id)" type="close" style="cursor: pointer" />
					                </div> -->
					<view class="qbox-3" v-for="item in fileList" :key="item.id">
						<view class="cbox-2">
							{{item.fileSourceNam}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getBase3Info,getInvestList
	} from '../../../api/service.js'
	export default {
		props: ['cgId', 'status'],
		data() {
			return {
				InvestList: [],
				reasonStatus: false,
				purGoal: '',
				purStandard: '',
				//新增字段
				governmentProcurementDemands: [],
				fileList: [],
				governmentProcurementDemandExplain: '',
				purAcceptStandard: "",
				importTarget: '',
				generalTarget: '',
				operationMaintenanceUser: "",
				equipmentManagerUser: '',
				installationPlace: '',
				equipmentUseArea: '',
				checkList: ''

			}
		},
		created() {
			this.queryBase3Info();
			this.queryInvestList();
		},

		methods: {
			// 附属基本信息
			queryBase3Info() {
				uni.showLoading({
				    title: '数据加载中'
				});
				getBase3Info({
					id: this.cgId
				}).then(res => {
					uni.hideLoading()
					this.operationMaintenanceUser = res.result.operationMaintenanceUser?res.result.operationMaintenanceUser.realName:'';
					this.equipmentManagerUser = res.result.equipmentManagerUser?res.result.equipmentManagerUser.realName:'';
					this.equipmentUseArea = res.result.equipmentUseArea?res.result.equipmentUseArea:'';
					this.installationPlace = res.result.installationPlace?res.result.installationPlace:'';
					this.purAcceptStandard = res.result.purAcceptStandard?res.result.purAcceptStandard:"";
					this.generalTarget = res.result.generalTarget?res.result.generalTarget:"";
					this.importTarget = res.result.importTarget?res.result.importTarget:"";
					this.purGoal = res.result.purGoal;
					this.purStandard = res.result.purStandard;
					this.governmentProcurementDemands = res.result.governmentProcurementDemands;
					this.fileList = res.result.cgPFBZFiles;
					if (res.result.governmentProcurementDemands.length != 5) {
						console.log(res.result.governmentProcurementDemands.length)
						this.reasonStatus = true
						this.governmentProcurementDemandExplain = res.result.governmentProcurementDemandExplain
					} else {
						this.reasonStatus = false
					}
					var list = res.result.safetyFactorList.map(item => {
						return item.safetyFactors
					})
					this.checkList = list.join(',')
				})
			},
			queryInvestList() {
				getInvestList({
					cgId: this.cgId
				}).then(res => {
					if (res.result && res.result.length) {
						this.InvestList = res.result;
					}
				})
			}

		}
	}
</script>

<style lang="scss">
	@import "../../../colorui/purchase.scss";

	.ql-blank,
	.qbox-3 {
		background: #F5F5F5;
		margin-bottom: 20rpx;
		margin-top: 20rpx;
		min-height: 60rpx;
	}
</style>
